//每个继承base.js的原js中,都要标明:companyInfo = jQuery.extend(null,companyInfo,base, null);
var base = {
		//查询
		query : function(){
			var self =this;
			var serializeObj = common.serializeJson("queryForm");
			var jsonStr = JSON.stringify(serializeObj);
			location.href=self.listUrl+"?jsonParam="+jsonStr;
		},
		//跳转到详情页
		toDetail : function (id){
			var self =this;
			location.href=this.toViewUrl+id;
		},
		//查看信息列表
		toList : function (){
			var self =this;
			location.href=self.listUrl;
		},
		//跳转到增加对象页面
		toAdd : function (){
			var self =this;
			location.href=self.toAddUrl;
		},
		//跳转到修改信息页面
	   toEdit : function (id){
		   var self =this;
			location.href=self.toEditUrl + id;
	   },
	   //初始化详情页面
	   initDetailPage : function(){
		   var self = this;
			self.getById(this.companyId.val(),function (result){
				if (result.s > 0) {
					self.setForm(result.data);
					$("input").attr("disabled",true);
					$("#addBtn").hide();
					$("._detail").show();
				}  
				else {
					hiOverAlert(resp.d,1000);
				}
			});
	   },
	   //ajax提交表单
	   ajaxSubmitForm  : function (){
		   var self = this;
			$('#addform').ajaxSubmit(function(resp) {
				if (resp.s > 0) {
					location=self.listUrl;
				} else {
					//唯一判断
					if(resp.s==-100) {
						 $("#name").validationEngine("showPrompt",resp.d,"error");
					}
				}
			});	
		},
		//根据ID得到对象
		  getById : function (id,callBack){
			  var self = this;
			   var obj = null;
			   var rData={"id" : id};
				$.ajax({
					url : self.getByIdUrl,
					data : rData,// 
					success :callBack
				});
		   },
		   //检查名称唯一性
		   checkNameExits : function (param,callBack){
			   var self =this;
				$.ajax({
					url : self.checkNameExitsUrl,
					data : param,// 
					success :callBack
				});
		   },
		   //检查名称，回调
		   checkNameExitCallBack : function (result){
			   if (result.s < 0) {
				   common.alert(result.d,2000);
			   }  
		   },
		   //跳转到删除页面
		   toDelete : function(id){
			   var self = this;
			   common.openModal("delete_sure","确定删除吗？");
			   $("#delete_sure_a").click(function(){
				  location.href= self.deleteUrl+id; 
			   });
		   },
}